package com.honey.mybatis.generator.page;

import com.honey.compilation.java.ClassDecoration;
import com.honey.core.compiler.CompilationException;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.core.types.FullyQualifiedJavaType;
import com.honey.mybatis.generator.AbstractClass;
import com.honey.mybatis.generator.MybatisPlugin;

public class PageClass extends AbstractClass{

	private static final String[] JAVA_DOC = new String[]{
		"分页类。",
		"注意: ",
		"<ul>",
		"<li>total > 0表示不计算记录集的总数</li>",
		"<li>total = 0表示计算记录集的总数</li>",
		"<li>total < 0表示不使用分页</li>",
		"</ul>",
	};
	
	public PageClass(MybatisPlugin mybatisPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(mybatisPlugin, introspectSchema, introspectSchemaColumn);
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractClass#getType()
	 */
	@Override
	protected FullyQualifiedJavaType getType() {
		return new FullyQualifiedJavaType(
				mybatisPlugin.getModelTargetPackage(),
				PageConstant.PAGE_NAME
		);
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractClass#getDecoration()
	 */
	@Override
	protected ClassDecoration getDecoration() throws CompilationException {
		ClassDecoration answer =  super.getDecoration();
		answer.setFinal(true);
		return answer;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractClass#getJavaDoc()
	 */
	@Override
	protected String[] getJavaDoc() {
		
		return JAVA_DOC;
	}
	
}
